﻿@model IEnumerable<VisaApp.Models.UserModel>
<script type="text/javascript">
    $(document).ready(function () {
        makeEventDialog("a.Editlogo");
        $("a#deteleCate").click(function () {
            var $this = $(this);
            var CateName = $this.closest('tr').find('.spanNameCate').html();
            if (confirm("Bạn muốn xóa user : " + CateName + "")) {
                var Cateid = $this.closest('tr').find('.Cate-id').html();
                $.get("/Quantri/DeteleUser?id=" + Cateid, function (data) {
                    var valueId = $("#RolesID").val();
                    $.get("/Quantri/GetListUserRolesId=" + valueId, function (data) {
                        $("#DivListCate").html("");
                        $("#DivListCate").html(data);
                    });
                    alert("xóa user " + CateName + " Thành công");
                });
            }
        });

    });

</script>
<table width="100%">
    <tr>
        <th>
            Name
        </th>
        <th>
            ngày Tạo
        </th>
        <th>
            Sửa
        </th>
        <th>
            Xóa
        </th>
    </tr>
    @if (Model != null)
    {
        foreach (var item in Model)
        {
        <tr>
            <td>
                <span class="Cate-id" style="display: none;">@item.UsID</span> <span class="spanNameCate">@item.UserFullName
                </span>
            </td>
            <td>
                @String.Format("{0:dd/MM/yyy HH:mm}", item.DateCreate)
            </td>
            <td>
                @Html.ActionLink("Edit", "EditUserAdmin", "Quantri", new { UserID = item.UsID }, new { @class = "t-button addPopup", data_dialog_id = "Editlogo", data_dialog_title = "Edit User" })
            </td>
            <td>
                <a href="javascript:void(0);" class="t-button" id="deteleCate">Xóa</a>
            </td>
        </tr>
        }
    }
</table>
